﻿///***************************************************************
/// 시  스  템 : Updms.Cfg
/// 단위시스템 : CFG
/// 계      층 : Presentation Layer
/// 프로그램명 : Cfg1010m
/// 파  일  명 : Cfg1010m.aspx.cs
/// 설      명 : 솔루션관리
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-07-15 송시명   최초 작성
///***************************************************************
using System;
using System.Data;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using SMFramework.Data;
using SMFramework.Utility;
using SMFramework.Web.UI.WebControls.Page;

using Base.AppFramework;
using Base.AppFramework.Web.UI.CommandBar;
using Base.Dac;

using Updms.Cfg.Exe;
using SMFramework.Adapter;
using SMFramework.Security;


namespace Updms.Cfg
{
	public partial class Cfg1010m : Updms.Common.BaseClass.PageBase
	{
		#region 전역영역

		public static readonly string PID = "Cfg1010m";
		public static readonly string gs_path_info = "/updms/Cfg/" + PID + ".aspx";
		
		Global global = new Global();
		Crypto crypto = new Crypto();
		CommCode.Cfg cfg = new CommCode.Cfg(LANG_SET);

		//페이징
		private int li_cur_page, li_row_count, li_st_page, li_ed_page;
		protected int li_page_size = GRID_PAGESIZE;// 한 페이지에 출력될 행의수

		//검색
		protected string kw1 = "";	// 검색1
		protected string kw2 = "";	// 검색2
		protected string kw3 = "";	// 검색3

		//메뉴 선택값
		protected string gs_sm = "";

		#endregion

		#region Page_Load, OnPageLoad

		protected void Page_Load(object sender, EventArgs e)
		{
			SetInit();
			if (!Page.IsPostBack)
			{
				// 최초 화면 로딩시 처리해야 할 부분
				OnPageLoad();
				SelectProcess();
			}
		}

		// OnPageLoad
		private void OnPageLoad()
		{
			SetLiterals(global.GetLabelInfoByPgmId(PID, LANG_SET));
			SetClientScript();
			SetCmdType();
			SetDate();
			SetSearchParameter();
		}

		#endregion

		#region InitializeComponent

		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
			this.PreRender += new System.EventHandler(this.Page_PreRender);
		}

		#endregion

		#region SetClientScript

		private void SetClientScript()
		{
			//onKeyPress이벤트 (엔터검색)
			txt_search_cmd_nm.Attributes.Add("onkeypress", "enterSearch(event)");
			txt_search_cmd_file_nm.Attributes.Add("onkeypress", "enterSearch(event)");
		}

		#endregion

		#region SetInit, SetSearchParameter, ShowKeywordLabel

		//초기값설정
		private void SetInit()
		{
			lbl_search_flag.Text = "INIT";
			if (Request.QueryString["page"] == null || int.Parse(Request.QueryString["page"]) == 1)
			{
				li_cur_page = 1;
				li_st_page = 0;
				li_ed_page = li_page_size;
			}
			else
			{
				li_cur_page = int.Parse(Request.QueryString["page"]);
				li_st_page = (int.Parse(Request.QueryString["page"]) - 1) * li_page_size;
				li_ed_page = li_st_page + li_page_size;
			}

			gs_sm = (Request.QueryString["sm"] == null || Request.QueryString["sm"].Trim().Length != 7)
					? global.GetDirDepth(PID) : Request.QueryString["sm"].ToString();
		}

		//검색파라미터
		private void SetSearchParameter()
		{
			switch(lbl_search_flag.Text.Trim().ToUpper())
			{
				case "INIT" :
					if (String.IsNullOrEmpty(Request.QueryString["kw1"]))	// url에 값이 없으면
					{
						kw1 = ddl_search_cmd_type.SelectedValue;
					}
					else
					{
						kw1 = Server.UrlDecode(Request.QueryString["kw1"]);
						ddl_search_cmd_type.SelectedValue = kw1;
					}
					if (String.IsNullOrEmpty(Request.QueryString["kw2"]))	// url에 값이 없으면
					{
						kw2 = txt_search_cmd_nm.Text.Trim();
					}
					else
					{
						kw2 = Server.UrlDecode(Request.QueryString["kw2"]);
						txt_search_cmd_nm.Text = kw2;
					}
					if (String.IsNullOrEmpty(Request.QueryString["kw3"]))	// url에 값이 없으면
					{
						kw3 = txt_search_cmd_file_nm.Text.Trim();
					}
					else
					{
						kw3 = Server.UrlDecode(Request.QueryString["kw3"]);
						txt_search_cmd_file_nm.Text = kw3;
					}
					break;
				case "SEARCH" :
					kw1 = ddl_search_cmd_type.SelectedValue;
					kw2 = txt_search_cmd_nm.Text.Trim();
					kw3 = txt_search_cmd_file_nm.Text.Trim();
					break;
			}
		}

		//검색키워드
		private void ShowKeywordLabel()
		{
			lbl_search_keyword.Text = kw1 + " / " + kw2 + " / " + kw3;
		}

		#endregion

		#region 마스터 Method (SetCmdType, ExecDbBackUp)

		//실행형식
		private void SetCmdType()
		{
			cfg.SetCmdType(ddl_search_cmd_type);
			cfg.SetCmdType(ddl_cmd_type);

			ddl_search_cmd_type.Items.Insert(0, new ListItem(DDL_SELECT, ""));
		}

		private void ExecDbBackUp()
		{
			string ls_db = "UPDMS";
			string ls_date = txt_date.Text;
			string ls_file_path = FILE_PATH_TEMP + ls_db + "_" + ls_date + ".bak";

			using (Cfg1010m_NT _Cfg1010m_NT = new Cfg1010m_NT())
			{
				int li_rslt = _Cfg1010m_NT.ExecDbBackUp(ls_file_path, ls_db);
			}

			try
			{
				if (FileUtil.IsFileExist(ls_file_path))
				{
					//압축파일 생성
					ExecFile("UPDMS_DB_Backup.bat", ls_date);

					Thread.Sleep(5000);	//5초후에 생성여부 확인

					string fileName = "DB_UPDMS_" + ls_date + ".rar";

					if (FileUtil.IsFileExist(FILE_PATH_UPDMS_DB + "\\" + fileName))
					{
						CallMsgBoxInAjax("MSG_INF_005");	//DB백업을 완료하였습니다
					}
				}
			}
			catch (Exception ex)
			{
				CallExceptionMsgBoxInAjax(ex);
			}
		}

		#endregion

		#region 디테일 Method (SetDate, DeleteFile)

		//현재날짜 설정
		private void SetDate()
		{
			txt_date.Text = DateUtil.GetNow("yyyyMMddHHmm");
		}

		// 파일삭제
		private void DeleteFile(string ls_file_name, bool lb_list_yn)
		{
			//실제 첨부파일삭제
			string ls_attach_file = FILE_PATH_UPLOAD_BATCH + ls_file_name;

			if (FileUtil.IsFileExist(ls_attach_file))
			{
				File.Delete(ls_attach_file);
			}
			else
			{
				CallMsgBoxInAjax("MSG_ERR_123");	//삭제할 파일이 없습니다
			}

			if (lb_list_yn)
			{
				SearchProcess();
			}
		}

		#endregion

		#region 리스트 Method (CreateFile, CreateFileReal, ExecFile)

		//파일생성
		private void CreateFile(int li_item_index)
		{
			//실행형식
			string ls_cmd_type = GridView1.DataKeys[li_item_index].Values["Cmd_Type"].ToString();

			//실행파일명
			string ls_file_name = GridView1.Rows[li_item_index].Cells[8].Text;

			//실행내용
			string ls_cmd_contents = GridView1.DataKeys[li_item_index].Values["Cmd_Contents"].ToString();

			//날짜가 공란이면 현재일자 기준
			if (String.IsNullOrEmpty(txt_date.Text))
			{
				ls_cmd_contents = ls_cmd_contents.Replace("[date]", DateUtil.GetNow("yyyyMMddHHmm"));
			}
			else
			{
				ls_cmd_contents = ls_cmd_contents.Replace("[date]", txt_date.Text.Trim());
			}

			//실행형식이 FTP이면 아이디와 비밀번호는 필수입력이다.			
			if (ls_cmd_type == "AA002")
			{
				if (String.IsNullOrEmpty(txt_url.Text) || String.IsNullOrEmpty(txt_id.Text) || String.IsNullOrEmpty(txt_pw.Text))
				{
					CallMsgBoxInAjax("MSG_ERR_130");	// URL,아이디,비밀번호를 모두 입력하세요
				}
				else
				{
					// 실행내용에 연결정보를 합친다.
					ls_cmd_contents = "open " + txt_url.Text + "\r\n" + txt_id.Text + "\r\n" + txt_pw.Text + "\r\n" + ls_cmd_contents;
					CreateFileReal(ls_file_name, ls_cmd_contents);
				}
			}
			else
			{
				CreateFileReal(ls_file_name, ls_cmd_contents);
			}
		}

		//실제파일생성
		private void CreateFileReal(string ls_file_nm, string ls_cmd_contents)
		{
			try
			{
				string ls_stream = FILE_PATH_UPLOAD_BATCH + ls_file_nm;
				FileInfo file = new FileInfo(ls_stream);
				
				StreamWriter sw = file.CreateText();

				//StreamWriter sw = new StreamWriter(ls_stream, false, Encoding.GetEncoding(1250));
				
				sw.WriteLine(ls_cmd_contents);
				sw.Close();
			}
			catch (Exception e)
			{
				SMEventLog.WriteErrorLog(e.ToString());
				CallMsgBoxInAjax("MSG_ERR_122");	//파일을 생성하지 못했습니다
			}

			//생성후 다시 조회
			SearchProcess();
		}

		//파일실행
		private void ExecFile(string ls_file_nm, string ls_arguments)
		{
			string ls_file_url = FILE_PATH_UPLOAD_BATCH + ls_file_nm;
			//string ls_output = "";

			try
			{
				if (FileUtil.IsFileExist(ls_file_url))
				{
					Process p = new Process();
					
					p.StartInfo.FileName = ls_file_url;
					p.StartInfo.Arguments = ls_arguments;
					p.StartInfo.CreateNoWindow = true;
					//p.StartInfo.RedirectStandardOutput = true;
					//p.StartInfo.UseShellExecute = false;
					
					p.Start();
				}
				else
				{
					CallMsgBoxInAjax("MSG_ERR_124");	//실행할 파일이 없습니다
				}
			}
			catch (Exception e)
			{
				SMEventLog.WriteErrorLog(e.ToString());
				CallMsgBoxInAjax("MSG_ERR_128");	//파일을 실행하지 못했습니다
			}
		}
			
		#endregion

		#region CRUD (SelectProcess, InsertProcess, UpdateProcess, DeleteProcess, SearchProcess)

		//조회
		private void SelectProcess()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();
			int li_page_count;
			
			//검색
			lo_dp.AddProperty("ls_cmd_type", typeof(string), kw1);
			lo_dp.AddProperty("ls_cmd_nm", typeof(string), kw2);
			lo_dp.AddProperty("ls_cmd_file_nm", typeof(string), kw3);
			
			using(Cfg1010m_NT _Cfg1010m_NT = new Cfg1010m_NT())
			{
				li_row_count = _Cfg1010m_NT.GetSearchCount(lo_dp);	// 검색된 행수
				li_page_count = (int)((li_row_count - 1) / li_page_size) + 1;	// 총페이지수 계산

				//모두보기/페이징
				lo_dp.AddProperty("li_st_page", typeof(Int32), (cb_list_all.Checked) ? 0 : li_st_page);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), (cb_list_all.Checked) ? li_row_count : li_ed_page);
				lo_dp.AddProperty("ls_lang_set", typeof(string), LANG_SET);
				lbl_page.Visible = !cb_list_all.Checked;

				lo_ds.Merge(_Cfg1010m_NT.SelectProcess(lo_dp));

				GridView1.DataSource = lo_ds;
				GridView1.DataBind();

				Pager pager = new Pager(this, ref lbl_page);
				pager.PageNavigation(
					li_cur_page,
					li_page_count,
					gs_path_info + "?sm=" + gs_sm + "&kw1=" + Server.UrlEncode(kw1) + "&kw2=" + Server.UrlEncode(kw2) + "&kw3=" + Server.UrlEncode(kw3) + "&page=");
				
				//결과출력(키워드, 검색행수)
				ShowKeywordLabel();
				lbl_result_count.Text = li_row_count.ToString("#,###,##0");
			}
		}

		//저장
		private void InsertProcess()
		{
			using (Cfg1010m_RT _Cfg1010m_RT = new Cfg1010m_RT())
			{
 				int li_return = _Cfg1010m_RT.InsertProcess(SetValue());
				string ls_msg_id = (li_return > 0) ? "MSG_INF_007" : "MSG_ERR_105";	//저장되었습니다:저장할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//수정
		private void UpdateProcess()
		{
			using (Cfg1010m_RT _Cfg1010m_RT = new Cfg1010m_RT())
			{
				int li_return = _Cfg1010m_RT.UpdateProcess(SetValue());
				string ls_msg_id = (li_return > 0) ? "MSG_INF_006" : "MSG_ERR_104";	//수정되었습니다:수정할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);
				
				SearchProcess();
			} 
		}

		//삭제
		private void DeleteProcess(string ls_xml)
		{
			using (Cfg1010m_RT _Cfg1010m_RT = new Cfg1010m_RT())
			{
				int li_return = _Cfg1010m_RT.DeleteProcess(ls_xml);
				string ls_msg_id = (li_return > 0) ? "MSG_INF_004" : "MSG_ERR_103";	//삭제되었습니다:삭제할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//즐겨찾기설정
		private void SetFavoriteYn(int li_seq)
		{
			DataPack lo_dp = new DataPack();
			lo_dp.AddProperty("li_seq", typeof(int), li_seq);
			lo_dp.AddProperty("ls_user_id", typeof(string), USER_ID);

			using (Cfg1010m_RT _Cfg1010m_RT = new Cfg1010m_RT())
			{
				int li_return = _Cfg1010m_RT.SetFavoriteYn(lo_dp);
			}
		}

		//검색
		private void SearchProcess()
		{
			lbl_search_flag.Text = "SEARCH";
			SetSearchParameter();
			ClearValue();
			SelectProcess();
		}

		#endregion

		#region SetValue, ClearValue

		//SetValue
		private DataPack SetValue()
		{
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("Seq", typeof(string), lbl_pk.Text);
			lo_dp.AddProperty("Cmd_Type", typeof(string), ddl_cmd_type.SelectedValue);
			lo_dp.AddProperty("Cmd_Nm", typeof(string), ConversionUtil.DefaultValue(txt_cmd_nm.Text));
			lo_dp.AddProperty("Cmd_File_Nm", typeof(string), ConversionUtil.DefaultValue(txt_cmd_file_nm.Text));
			lo_dp.AddProperty("Cmd_Contents", typeof(string), ConversionUtil.DefaultValue(txt_cmd_contents.Text));
			lo_dp.AddProperty("Create_User", typeof(string), USER_ID);
			lo_dp.AddProperty("Create_Dt", typeof(string), "");
			lo_dp.AddProperty("Update_User", typeof(string), USER_ID);
			lo_dp.AddProperty("Update_Dt", typeof(string), "");

			return lo_dp;
		}

		//ClearValue
		private void ClearValue()
		{
			lbl_pk.Text					= "";
			h_no.Value					= "";
			ddl_cmd_type.SelectedIndex	= 0;
			txt_cmd_nm.Text				= "";
			txt_cmd_file_nm.Text		= "";
			txt_cmd_contents.Text		= "";
			ibtn_delete_attach_file1.Visible = false;
		}

		#endregion

		#region Page_PreRender, ChangePageMode

		// Page_PreRender
		private void Page_PreRender(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				using (AccessCheck access = new AccessCheck())
				{
					//접근권한 체크
					if (!access.CheckPgmAccessGrant(PID, USER_ID, ACCESS_LOG_INFO))
					{
						Response.Redirect(URL_NO_AUTHORITY_REDIRECT_BASE);	//사용자의 권한은 요청하신 페이지를 볼 수 없습니다
					}
					//사용권한별 버튼처리
					PagePreRender.SetVisibleCtrl(this, access.CheckPgmUsingGrant(USER_DIV, PID), access.GetVisibleCtrl(PID));
				}
			}
			ChangePageMode();
		}

		//ChangePageMode
		private void ChangePageMode()
		{
			SetGridViewHeader(global.GetColumnListByPgmId(PID, LANG_SET));
		}

		#endregion

		#region GridView이벤트

		//RowDataBound
		protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
		{
			if (e.Row.RowType == DataControlRowType.DataRow)
			{
				//마우스올렸을 때
				e.Row.Attributes.Add("onmouseover", "overBackground('GridView1', " + (e.Row.RowIndex + 1) + ")");
				e.Row.Attributes.Add("onmouseout", "outBackground('GridView1', 1)");

				//번호
				e.Row.Cells[1].Text = ((li_row_count - ((li_cur_page - 1) * li_page_size)) - e.Row.RowIndex).ToString();

				//생성
				e.Row.Cells[10].Text
                    = "<div class=\"sbtn sbtn_create\" title=\"생성\" onclick=\"javascript:createFile('" + e.Row.RowIndex + "', '" + e.Row.Cells[8].Text.Trim() + "');\" /> ";
				//실행
				e.Row.Cells[11].Text = FileUtil.IsFileExist(FILE_PATH_UPLOAD_BATCH + e.Row.Cells[8].Text.Trim()) 
					? "<div class=\"sbtn sbtn_exec\" title=\"실행\" onclick=\"javascript:execFile('" + e.Row.Cells[8].Text.Trim() + "');\" /> " : "";
			}
		}
		
		//RowCommand
		protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			GridView gv = (GridView)sender;
			GridViewRow row = (GridViewRow)(((Control)e.CommandSource).NamingContainer);

			LinkButton lbtn_rc = (LinkButton)GridView1.Rows[row.RowIndex].FindControl("lbtn_rc");

			//row.Cells[0].Text.ToString();//0.체크박스
			h_no.Value					= row.Cells[1].Text.ToString();									//1.번호
			lbl_pk.Text					= gv.DataKeys[row.RowIndex].Values["Seq"].ToString();			//2.Seq
																										//3.Favorite_Yn
																										//4.Favorite_Yn_Icon
			ddl_cmd_type.SelectedValue	= gv.DataKeys[row.RowIndex].Values["Cmd_Type"].ToString();		//5.Cmd_Type
			//cmd_type_nm																				//6.Cmd_Type_Nm	
			txt_cmd_nm.Text				= lbtn_rc.Text;													//7.Cmd_Nm (template)
			txt_cmd_file_nm.Text		= row.Cells[8].Text.Trim();										//8.Cmd_File_Nm
			txt_cmd_contents.Text		= gv.DataKeys[row.RowIndex].Values["Cmd_Contents"].ToString();	//9.Cmd_Contents

			// 파일이 있으면 삭제버튼 활성화
			ibtn_delete_attach_file1.Visible = FileUtil.IsFileExist(FILE_PATH_UPLOAD_BATCH + txt_cmd_file_nm.Text);
		}
		

		#endregion

		#region 버튼이벤트

		//검색
		protected void ibtn_search_Click(object sender, EventArgs e)
		{
			SearchProcess();
		}

		//저장
		protected void ibtn_save_Click(object sender, EventArgs e)
		{
			if (global.CheckSaveMode("UPDMS_CFG_BATCH_MGT", "Seq", lbl_pk.Text.Trim()))
			{
				UpdateProcess();
			}
			else
			{
				InsertProcess();
			}
		}

		//삭제
		protected void ibtn_delete_Click(object sender, EventArgs e)
		{
			StringBuilder sb = new StringBuilder();

			sb.Append("<UPDMS>");

			for (int i = 0; i < GridView1.Rows.Count; i++)
			{
				GridViewRow row = GridView1.Rows[i];
				HtmlInputCheckBox cb = (HtmlInputCheckBox)row.FindControl("cb_check");

				if (cb.Checked)
				{
					string ls_seq = GridView1.DataKeys[i].Values["Seq"].ToString();
					sb.Append("<UPDMS_CFG_BATCH_MGT>");
					sb.Append("<Seq>" + ls_seq + "</Seq>");
					sb.Append("</UPDMS_CFG_BATCH_MGT>");
				}
			}
			sb.Append("</UPDMS>");

			DeleteProcess(sb.ToString());
		}

		//파일삭제
		protected void ibtn_delete_attach_file1_Click(object sender, EventArgs e)
		{
			DeleteFile(txt_cmd_file_nm.Text, true);
		}

		//DB백업
		protected void ibtn_backup_Click(object sender, EventArgs e)
		{
			ExecDbBackUp();
		}

		//엑셀
		protected void ibtn_excel_Click(object sender, EventArgs e)
		{
			SetSearchParameter();

			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("ls_cmd_type", typeof(string), kw1);
			lo_dp.AddProperty("ls_cmd_nm", typeof(string), kw2);
			lo_dp.AddProperty("ls_cmd_file_nm", typeof(string), kw3);

			using (Cfg1010m_NT _Cfg1010m_NT = new Cfg1010m_NT())
			{
				li_row_count = _Cfg1010m_NT.GetSearchCount(lo_dp);

				lo_dp.AddProperty("li_st_page", typeof(Int32), 0);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), li_row_count);
				lo_dp.AddProperty("ls_lang_set", typeof(string), LANG_SET);

				lo_ds.Merge(_Cfg1010m_NT.SelectProcess(lo_dp));
			}
			string fileName = PID + "(" + global.GetMenuTitle(PID, LANG_SET) + ")";
			ExcelUtil.CreateExcelFileX(this.Page, fileName, lo_ds, SetExcelHeaderX(global.GetColumnListByPgmId(PID, LANG_SET)));
		}

		//즐겨찾기설정(리스트에서)
		protected void lbtn_favorite_yn_Click(object sender, EventArgs e)
		{
			SetFavoriteYn(Convert.ToInt32(h_seq.Value));
			SearchProcess();
		}
		
		//생성(리스트에서)
		protected void lbtn_create_file_Click(object sender, EventArgs e)
		{
			using (AccessCheck access = new AccessCheck())
			{
				if (access.CheckPgmUsingGrant(USER_DIV, PID))
				{
					CreateFile(Convert.ToInt32(h_item.Value));
				}
				else
				{
					CallMsgBoxInAjax("MSG_ERR_109");	//작업에 필요한 권한이 없습니다
				}
			}
		}

		//실행(리스트에서)
		protected void lbtn_exec_file_Click(object sender, EventArgs e)
		{
			using (AccessCheck access = new AccessCheck())
			{
				if (access.CheckPgmUsingGrant(USER_DIV, PID))
				{
					ExecFile(h_cmd_file_nm.Value, "");
				}
				else
				{
					CallMsgBoxInAjax("MSG_ERR_109");	//작업에 필요한 권한이 없습니다
				}
			}
		}

		//FTP
		protected void ibtn_ftp_Click(object sender, EventArgs e)
		{
			string ls_date = txt_date.Text;
			string fileName = "DB_UPDMS_" + ls_date + ".zip";
						
			FtpClient fc = new FtpClient(FTP_HOSTNAME, FTP_USERID, crypto.Decrypt(FTP_PASSWORD));

			try
			{
				//FTP전송
				if (FileUtil.IsFileExist(FILE_PATH_UPDMS_DB + "\\" + fileName))
				{
					fc.Login();
					fc.BinaryMode = false;

					string[] remoteDir = StringUtil.DelimitedListToStringArray(FTP_DIR_UPDMS_DB, "/");
					for (int i = 0; i < remoteDir.Length; i++)
					{
						fc.ChangeDir(remoteDir[i]);
					}

					if (fc.IsFileExist(fileName))
					{
						fc.DeleteFile(fileName);
					}

					fc.UploadOnlyFile(FILE_PATH_UPDMS_DB, fileName, "", "", true);
					fc.Close();

					CallMsgBoxInAjax("MSG_INF_018");	//전송되었습니다
				}
				else
				{
					CallMsgBoxInAjax("MSG_ERR_164");	//전송할 파일이 없습니다.
				}
			}
			catch (Exception ex)
			{
				CallExceptionMsgBoxInAjax(ex);
			}
			finally
			{
				fc.Close();
			}
		}

		//모두보기
		protected void cb_list_all_CheckedChanged(object sender, EventArgs e)
		{
			SearchProcess();
		}

		#endregion

	}
}
